package com.jeff.serviceImpl;

import com.jeff.mapper.UserMapper;
import com.jeff.mybatis.page.Page;
import com.jeff.po.User;
import com.jeff.service.UserService;
import com.jeff.vo.InfoVo;
import com.jeff.vo.UserPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class UserServiceImpl extends BaseServiceImpl<User, String> implements
        UserService {
    @Autowired
    private UserMapper userMapper;

    @Autowired
    public void setBaseMapper() {
        super.setBaseMapper(userMapper);
    }

    @Override
    public Page<UserPage> getUserByPage(User user,String searchDeptId) {
        HashMap<String,Object> map=new HashMap<String,Object>();
        map.put("name",user.getName());
        map.put("deptId",user.getDeptId());
        map.put("loginName",user.getLoginName());
        map.put("gradeId",user.getGradeId());
        map.put("searchDeptId",searchDeptId);
        return this.buildVoPage(userMapper.getUserByPage(map));
    }

    @Override
    public InfoVo getUserInfo(User user) {
        return userMapper.getUserInfo(user);

    }
}
